<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  

  
  <title>CSS进阶知识点--文本与字体（overflow 及获取特殊字体） | Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="CSS3 文本阴影text-shadow 属性应用于阴影文本 语法 text-shadow：h-shadow v-shadow blur color  text-outline 属性规定文本轮廓 语法 text-outline：thickness(轮廓粗细) blur color  兼容性任何主流浏览器都不支持 text-outline 属性 CSS3 换行word-break 属性规定自动换行">
<meta name="keywords" content="CSS3">
<meta property="og:type" content="article">
<meta property="og:title" content="CSS进阶知识点--文本与字体（overflow 及获取特殊字体）">
<meta property="og:url" content="http://yoursite.com/2019/08/17/CSS进阶知识点-文本与字体及overflow和获取特殊字符/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="CSS3 文本阴影text-shadow 属性应用于阴影文本 语法 text-shadow：h-shadow v-shadow blur color  text-outline 属性规定文本轮廓 语法 text-outline：thickness(轮廓粗细) blur color  兼容性任何主流浏览器都不支持 text-outline 属性 CSS3 换行word-break 属性规定自动换行">
<meta property="og:locale" content="default">
<meta property="og:image" content="https://img.mukewang.com/climg/5d53e233000170f712800720.jpg">
<meta property="og:updated_time" content="2019-08-17T09:53:25.933Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CSS进阶知识点--文本与字体（overflow 及获取特殊字体）">
<meta name="twitter:description" content="CSS3 文本阴影text-shadow 属性应用于阴影文本 语法 text-shadow：h-shadow v-shadow blur color  text-outline 属性规定文本轮廓 语法 text-outline：thickness(轮廓粗细) blur color  兼容性任何主流浏览器都不支持 text-outline 属性 CSS3 换行word-break 属性规定自动换行">
<meta name="twitter:image" content="https://img.mukewang.com/climg/5d53e233000170f712800720.jpg">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-CSS进阶知识点-文本与字体及overflow和获取特殊字符" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/08/17/CSS进阶知识点-文本与字体及overflow和获取特殊字符/" class="article-date">
  <time datetime="2019-08-17T06:58:34.000Z" itemprop="datePublished">2019-08-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/CSS3/">CSS3</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      CSS进阶知识点--文本与字体（overflow 及获取特殊字体）
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h1 id="CSS3-文本阴影"><a href="#CSS3-文本阴影" class="headerlink" title="CSS3 文本阴影"></a>CSS3 文本阴影</h1><h2 id="text-shadow-属性"><a href="#text-shadow-属性" class="headerlink" title="text-shadow 属性"></a>text-shadow 属性</h2><p>应用于阴影文本</p>
<h3 id="语法"><a href="#语法" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>text-shadow：h-shadow v-shadow blur color</p>
</blockquote>
<h2 id="text-outline-属性"><a href="#text-outline-属性" class="headerlink" title="text-outline 属性"></a>text-outline 属性</h2><p>规定文本轮廓</p>
<h3 id="语法-1"><a href="#语法-1" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>text-outline：thickness(轮廓粗细) blur color</p>
</blockquote>
<h3 id="兼容性"><a href="#兼容性" class="headerlink" title="兼容性"></a>兼容性</h3><p>任何主流浏览器都不支持 text-outline 属性</p>
<h1 id="CSS3-换行"><a href="#CSS3-换行" class="headerlink" title="CSS3 换行"></a>CSS3 换行</h1><h2 id="word-break-属性"><a href="#word-break-属性" class="headerlink" title="word-break 属性"></a>word-break 属性</h2><p>规定自动换行的处理方法</p>
<h3 id="语法-2"><a href="#语法-2" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>word-break：normal | break-all | keep-all</p>
</blockquote>
<h2 id="word-wrap-属性"><a href="#word-wrap-属性" class="headerlink" title="word-wrap 属性"></a>word-wrap 属性</h2><p>允许长单词或 URL 地址换行到下一行,只针对英文</p>
<h3 id="语法-3"><a href="#语法-3" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>word-wrap：normal | break-word</p>
</blockquote>
<h1 id="CSS3-新文本属性"><a href="#CSS3-新文本属性" class="headerlink" title="CSS3 新文本属性"></a>CSS3 新文本属性</h1><h2 id="text-align-last-属性"><a href="#text-align-last-属性" class="headerlink" title="text-align-last 属性"></a>text-align-last 属性</h2><p>规定如何对齐文本最后一行</p>
<h3 id="语法-4"><a href="#语法-4" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>text-align-last：auto | left | right | center | justify | start | end | initial | inherit</p>
</blockquote>
<h3 id="兼容性-1"><a href="#兼容性-1" class="headerlink" title="兼容性"></a>兼容性</h3><p>只有 IE 支持，火狐浏览器要加上前缀</p>
<h3 id="注意"><a href="#注意" class="headerlink" title="注意"></a>注意</h3><p>text-align-last 属性只有在 text-align 属性设置为 “justify” 时才起作用</p>
<h2 id="text-overflow-属性"><a href="#text-overflow-属性" class="headerlink" title="text-overflow 属性"></a>text-overflow 属性</h2><p>规定当文本溢出包含元素时发生的事情</p>
<h3 id="语法-5"><a href="#语法-5" class="headerlink" title="语法"></a>语法</h3><blockquote>
<p>text-overflow：clip | ellipsis | string</p>
</blockquote>
<h3 id="注意-1"><a href="#注意-1" class="headerlink" title="注意"></a>注意</h3><ol>
<li><p>在写 text-overflow 时，一定要在前面写上 <code>overflow：hidden</code></p>
</li>
<li><p>string 属性值只有在火狐浏览器中兼容</p>
</li>
</ol>
<h1 id="font-face"><a href="#font-face" class="headerlink" title="@font-face"></a>@font-face</h1><h2 id="语法规则"><a href="#语法规则" class="headerlink" title="语法规则"></a>语法规则</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">@font-face&#123;</span><br><span class="line">    font-family: &lt;YourWebFontName&gt;;              //字体名称，必填</span><br><span class="line">    src: &lt;source&gt;[&lt;format&gt;][&lt;source&gt;[&lt;format&gt;]]*;//字体存放路径，可多个，必填</span><br><span class="line">    [font-weight: &lt;weight&gt;];                     //字体粗细，选填</span><br><span class="line">    [font-style: &lt;style&gt;];                       //字体样式，选填</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="取值规则"><a href="#取值规则" class="headerlink" title="取值规则"></a>取值规则</h3><h4 id="YourWebFontName"><a href="#YourWebFontName" class="headerlink" title="YourWebFontName"></a>YourWebFontName</h4><p>自定义的字体名称，他将被引用到 Web 元素中的 font-family</p>
<h4 id="source"><a href="#source" class="headerlink" title="source"></a>source</h4><p>自定义的字体的存放路径，可以是相对路径也可以是绝对路径（建议用相对路径）</p>
<h4 id="format"><a href="#format" class="headerlink" title="format"></a>format</h4><p>自定义字体的格式，主要用来帮助浏览器识别</p>
<h4 id="weight-和-style"><a href="#weight-和-style" class="headerlink" title="weight 和 style"></a>weight 和 style</h4><p>粗体和斜体</p>
<h3 id="字体格式"><a href="#字体格式" class="headerlink" title="字体格式"></a>字体格式</h3><h4 id="TrueType-tff-格式："><a href="#TrueType-tff-格式：" class="headerlink" title="TrueType(.tff)格式："></a>TrueType(.tff)格式：</h4><p>.ttf 字体是 Windows 和 Mac 的最常见的字体，是一种 RAW 格式，因此他不为网站优化</p>
<p>可以用在手机端</p>
<h4 id="OpenType-otf-格式"><a href="#OpenType-otf-格式" class="headerlink" title="OpenType(.otf)格式"></a>OpenType(.otf)格式</h4><p>.otf 字体被认为是一种原始的字体格式，其内置在 TureType 的基础上，所以也提供了更多的功能</p>
<p>可以用于手机端</p>
<h4 id="Web-Open-Font-Format-woff-格式："><a href="#Web-Open-Font-Format-woff-格式：" class="headerlink" title="Web Open Font Format(.woff)格式："></a>Web Open Font Format(.woff)格式：</h4><p>.woff 字体是 Web 字体中最佳格式，他是一个开放的 TrueType / OpenType 的压缩版本，同时也支持元数据包的分离</p>
<p>不能用于手机端</p>
<h4 id="Embedded-Open-Type-eot-格式："><a href="#Embedded-Open-Type-eot-格式：" class="headerlink" title="Embedded Open Type(.eot)格式："></a>Embedded Open Type(.eot)格式：</h4><p>.eot 字体是 IE 专用字体，可以从 TrueType 创建此格式字体</p>
<p>只有 IE 可以兼容</p>
<h4 id="SVG-svg-格式："><a href="#SVG-svg-格式：" class="headerlink" title="SVG(.svg)格式："></a>SVG(.svg)格式：</h4><p>.svg 字体是基于 SVG 字体渲染的一种格式</p>
<h2 id="字体的应用"><a href="#字体的应用" class="headerlink" title="字体的应用"></a>字体的应用</h2><p><img src="https://img.mukewang.com/climg/5d53e233000170f712800720.jpg" alt></p>
<h1 id="overflow-属性"><a href="#overflow-属性" class="headerlink" title="overflow 属性"></a>overflow 属性</h1><ul>
<li><p>visible    默认值。内容不会被修剪，会呈现在元素框之外。</p>
</li>
<li><p>hidden    内容会被修剪，并且其余内容是不可见的。</p>
</li>
<li><p>scroll    内容会被修剪，但是浏览器会显示滚动条以便查看其余的内容。</p>
</li>
<li><p>auto    如果内容被修剪，则浏览器会显示滚动条以便查看其余的内容。</p>
</li>
<li><p>inherit    规定应该从父元素继承 overflow 属性的值。</p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/08/17/CSS进阶知识点-文本与字体及overflow和获取特殊字符/" data-id="ck4r400o4001dl0w0mm8p08br" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/CSS3/">CSS3</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2019/08/18/CSS进阶知识点-2D转换/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          CSS3进阶知识点--2D转换
        
      </div>
    </a>
  
  
    <a href="/2019/08/16/CSS进阶知识点-渐变/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">CSS进阶知识点--渐变</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Ajax/">Ajax</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS/">CSS</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS3/">CSS3</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Dart/">Dart</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Flutter/">Flutter</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Git/">Git</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/HTML/">HTML</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/HTML5/">HTML5</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/JSON/">JSON</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/QT/">QT</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/React/">React</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Sass/">Sass</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/TheKnowledgeOf/">TheKnowledgeOf</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/TypeScript/">TypeScript</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/bootstrap/">bootstrap</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/jQuery/">jQuery</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Ajax/">Ajax</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS/">CSS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS3/">CSS3</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Dart/">Dart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Flutter/">Flutter</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/">Git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HTML/">HTML</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HTML5/">HTML5</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JSON/">JSON</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/">Java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Javascript/">Javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/QT/">QT</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/React/">React</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Sass/">Sass</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TheKnowledgeOf/">TheKnowledgeOf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TypeScript/">TypeScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/bootstrap/">bootstrap</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jQuery/">jQuery</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Ajax/" style="font-size: 12.22px;">Ajax</a> <a href="/tags/CSS/" style="font-size: 18.89px;">CSS</a> <a href="/tags/CSS3/" style="font-size: 17.78px;">CSS3</a> <a href="/tags/Dart/" style="font-size: 14.44px;">Dart</a> <a href="/tags/Flutter/" style="font-size: 16.67px;">Flutter</a> <a href="/tags/Git/" style="font-size: 12.22px;">Git</a> <a href="/tags/HTML/" style="font-size: 14.44px;">HTML</a> <a href="/tags/HTML5/" style="font-size: 12.22px;">HTML5</a> <a href="/tags/JSON/" style="font-size: 10px;">JSON</a> <a href="/tags/Java/" style="font-size: 11.11px;">Java</a> <a href="/tags/JavaScript/" style="font-size: 20px;">JavaScript</a> <a href="/tags/Javascript/" style="font-size: 10px;">Javascript</a> <a href="/tags/QT/" style="font-size: 12.22px;">QT</a> <a href="/tags/React/" style="font-size: 15.56px;">React</a> <a href="/tags/Sass/" style="font-size: 11.11px;">Sass</a> <a href="/tags/TheKnowledgeOf/" style="font-size: 11.11px;">TheKnowledgeOf</a> <a href="/tags/TypeScript/" style="font-size: 10px;">TypeScript</a> <a href="/tags/bootstrap/" style="font-size: 11.11px;">bootstrap</a> <a href="/tags/jQuery/" style="font-size: 13.33px;">jQuery</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">December 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">November 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">October 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">September 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">August 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">July 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">June 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">May 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">April 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">March 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2019/12/29/Flutter-MaterialApp常用属性介绍/">Flutter-MaterialApp常用属性介绍</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-ListView/">Flutter-ListView</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-AppBar/">Flutter-AppBar</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-TabBar/">Flutter-TabBar</a>
          </li>
        
          <li>
            <a href="/2019/12/29/Flutter-按钮/">Flutter-按钮</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2019 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>